package com.coolw.toolkit.guava.collect;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

import java.util.Collection;

/**
 * Multimap：key可以重复，value返回数组
 *
 * @author coolw
 * @date 2024/1/25 9:23
 */
public class MultimapTest {

    public static void main(String[] args) {
        Multimap<String, String> multimap = HashMultimap.create();
        multimap.put("code", "111");
        multimap.put("code", "222");
        multimap.put("code", "333");

        Collection<String> collect = multimap.get("code");
        // 输出 [111, 222, 333]
        System.out.println(collect);
    }
}
